package com.finance.cooperate.feature.builder;

import com.finance.cooperate.common.exception.DBConnectException;
import com.finance.cooperate.common.pojo.RestResult;
import com.finance.cooperate.feature.builder.submodel.IntermediateFeature;
import com.finance.cooperate.feature.builder.submodel.PmmlModelResult;
import com.finance.cooperate.feature.core.base.AbstractProcess;
import com.finance.cooperate.feature.core.base.Builder;
import com.finance.cooperate.feature.core.base.Reader;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @ClassName FirstLoanFeatureProcess
 * @Description 用于首贷模型输出
 * @Author shen
 * @Date 2022/5/26 11:38
 * @Modify ...
 */
@Slf4j
public class FirstLoanFeatureProcess extends AbstractProcess {


    @Override
    public RestResult run(String userId, Builder<Reader> builder) throws DBConnectException {

        Map<String, String> map = super.init(userId, builder);

        map = new IntermediateFeature()
                .setResult(map)
                .read(userId);

        map = new PmmlModelResult()
                .setResult(map)
                .read(userId);

        return RestResult.ok(map);
    }
}
